#vim: noexpandtab
CC= gcc
CFLAGS= -Wall -g -O0
LFLAGS= -Wall -g -O0

OBJS= ./rsrcmanager/rsrcmanager.o ./ncis/ncis.o ./chainedlib/chainedlist.o ./sharedmemory/sharedmemory.o ./osocklib/osocklib.o ./ftal/ftal.o ./log/log.o ./core/nbh.o ./core/rsrclist.o ./core/main.o

EXE= yopd
CCDV= ./ccdv

include arch.mk

LIBS=
include $(addsuffix libs.mk, $(dir $(OBJS)))

.PHONY: all
all: arch_info $(CCDV) $(EXE)

$(EXE): $(OBJS)
	@$(CCDV) $(CC) $(LFLAGS) $^ -o $@ $(LIBS)

$(CCDV):
	@( cd ./_ccdv; $(MAKE))

#$(OBJS):
#	@( cd $(@D); $(MAKE) --no-print-directory $(@F))
%.o: %.c
	@$(MAKE) -C $(@D) --no-print-directory $(@F)


arch_info:
	@echo "Compiling on $(ARCH)";


refresh:
	rm -f *.log /tmp/.S[EH]M*

.PHONY: clean
clean:
	rm -f $(OBJS)

.PHONY: distclean
distclean: clean
	rm -f $(CCDV) $(EXE)

